-- 导航行为的基类

-- 模块定义
local M = 
{
	_base_class = require "objects.Object",
	_class_name = "ai.SteerBaseBehaviour"
}
setmetatable (M, {__index = _G;});
_ENV = M;

-- 引用模块
local Tools = require ("tools.CommonTools");

-- 方法定义
operation_table = Tools.CreateOperationTable (_base_class);

function operation_table.SetEnabled (self, enabled)
	self._enabled = enabled;
end

function operation_table.GetEnabled (self)
	return self._enabled;
end

function operation_table.GetName (self) 
	error ("Subclasses should implements this method.");
end

function operation_table.SetPriority (self, value)
	self._priority = value;
end

function operation_table.GetPriority (self)
	return self._priority;
end

function operation_table.SetWeight (self, value)
	self._weight = value;
end

function operation_table.GetWeight (self)
	return self._weight;
end

function operation_table.Update (self, currentTime, deltaTime)
	-- 子类当重写该函数以执行导航逻辑
end

-- 构造方法
function NewSteerBaseBahaviour (steerComponent)
	local instance = _base_class.NewObject ();
	Tools.PrepareInstance (M, instance);
	
	-- 在这里定义成员变量
	instance._steerComponent = steerComponent;
	instance._priority = 0;
	instance._weight = 1.0;
	instance._enabled = false;
	
	return instance;
end;

return M;

